#include "StdAfx.h"
#include "Ctrl.h"


CCtrl::CCtrl(void)
{
	_dwCurState = STEP_STOP;
}

CCtrl::~CCtrl(void)
{
}

STATE CCtrl::GoNextStep()
{
	int temp = (int)_dwCurState;
	if(_dwCurState != STEP_FINISH)
	{
		temp ++;
		_dwCurState = STATE(temp);
	}
	return _dwCurState;
}

STATE CCtrl::GoNextStep(STATE begin, STATE end)
{
	if(_dwCurState == STEP_STOP)
	{
		_dwCurState = begin;
		return begin;
	}
	else if(_dwCurState >= end)
	{
		_dwCurState = STEP_STOP;
		return STEP_STOP;
	}
	else
		return GoNextStep();
}

STATE CCtrl::GetCurState()
{
	return _dwCurState;
}

void CCtrl::SetState(STATE state)
{
	_dwCurState = state;
}